﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace BSE.Windows.Test
{
    public partial class KeshiForm : Form
    {
        public Keshi keshi = null;

        public KeshiForm()
        {
            InitializeComponent();
        }

        private void KeshiForm_Load(object sender, EventArgs e)
        {
            if (keshi != null)
            {
                textBoxCode.Text = keshi.KeshiCode;
                textBoxName.Text = keshi.KeshiName;
            }
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (textBoxCode.Text.Length == 0)
            {
                MessageBox.Show("科室编码不能为空", "医院", MessageBoxButtons.OK, MessageBoxIcon.Error);
                textBoxCode.Focus();
            }

            if (textBoxName.Text.Length == 0)
            {
                MessageBox.Show("科室名称不能为空", "医院", MessageBoxButtons.OK, MessageBoxIcon.Error);
                textBoxName.Focus();
            }

            if (keshi == null)
                keshi = new Keshi();
            keshi.KeshiCode = textBoxCode.Text;
            keshi.KeshiName = textBoxName.Text;
        }
    }
}
